
package system.base;

import framework.core.*;

/*
	Author    :Wing
	CreateTime:2008-02-20 17:44:59
*/
public class OutHeadHisSearchEvent extends SearchEvent
{

	private String m_id = "" ; // all

	private String m_out_bill_code = "" ; // all

	private String m_warehouse_code = "" ; // all

	private String m_warehouse_name = "" ; // all

	private String m_customer_code = "" ; // all

	private String m_customer_name = "" ; // all

	private String m_repair_bill_code = "" ; // all

	private String m_customer_bus_code = "" ; // all

	private String m_other_warehouse_code = "" ; // all

	private String m_other_warehouse_name = "" ; // all

	private String m_out_time = "" ; // all

	private String m_out_type = "" ; // all

	private double m_out_money = Value.NULL_DOUBLE ; // all

	private String m_remark = "" ; // all

	private String m_balance_flag = "" ; // all

	private String m_balance_user_id = "" ; // all

	private String m_balance_user = "" ; // all

	private String m_balance_time = "" ; // all

	private String m_status = "" ; // all

	private String m_create_user_id = "" ; // all

	private String m_create_user = "" ; // all

	private String m_create_time = "" ; // all

	private String m_last_update_user_id = "" ; // all

	private String m_last_update_user = "" ; // all

	private String m_last_update_time = "" ; // all

	private String m_is_sync = "" ; // all

public OutHeadHisSearchEvent() 
{
	super();
	
	setOrderField(OutHead.OUT_BILL_CODE);
		
}


    
	public String getId()
	{
		return m_id ;
	}
	public void setId(String v)
	{
		m_id = v;
	}

	public String getOutBillCode()
	{
		return m_out_bill_code ;
	}
	public void setOutBillCode(String v)
	{
		m_out_bill_code = v;
	}

	public String getWarehouseCode()
	{
		return m_warehouse_code ;
	}
	public void setWarehouseCode(String v)
	{
		m_warehouse_code = v;
	}

	public String getWarehouseName()
	{
		return m_warehouse_name ;
	}
	public void setWarehouseName(String v)
	{
		m_warehouse_name = v;
	}

	public String getCustomerCode()
	{
		return m_customer_code ;
	}
	public void setCustomerCode(String v)
	{
		m_customer_code = v;
	}

	public String getCustomerName()
	{
		return m_customer_name ;
	}
	public void setCustomerName(String v)
	{
		m_customer_name = v;
	}

	public String getRepairBillCode()
	{
		return m_repair_bill_code ;
	}
	public void setRepairBillCode(String v)
	{
		m_repair_bill_code = v;
	}

	public String getCustomerBusCode()
	{
		return m_customer_bus_code ;
	}
	public void setCustomerBusCode(String v)
	{
		m_customer_bus_code = v;
	}

	public String getOtherWarehouseCode()
	{
		return m_other_warehouse_code ;
	}
	public void setOtherWarehouseCode(String v)
	{
		m_other_warehouse_code = v;
	}

	public String getOtherWarehouseName()
	{
		return m_other_warehouse_name ;
	}
	public void setOtherWarehouseName(String v)
	{
		m_other_warehouse_name = v;
	}

	public String getOutTime()
	{
		return m_out_time ;
	}
	public void setOutTime(String v)
	{
		m_out_time = v;
	}

	public String getOutType()
	{
		return m_out_type ;
	}
	public void setOutType(String v)
	{
		m_out_type = v;
	}

	public double getOutMoney()
	{
		return m_out_money ;
	}
	public void setOutMoney(double v)
	{
		m_out_money = v;
	}

	public String getRemark()
	{
		return m_remark ;
	}
	public void setRemark(String v)
	{
		m_remark = v;
	}

	public String getBalanceFlag()
	{
		return m_balance_flag ;
	}
	public void setBalanceFlag(String v)
	{
		m_balance_flag = v;
	}

	public String getBalanceUserId()
	{
		return m_balance_user_id ;
	}
	public void setBalanceUserId(String v)
	{
		m_balance_user_id = v;
	}

	public String getBalanceUser()
	{
		return m_balance_user ;
	}
	public void setBalanceUser(String v)
	{
		m_balance_user = v;
	}

	public String getBalanceTime()
	{
		return m_balance_time ;
	}
	public void setBalanceTime(String v)
	{
		m_balance_time = v;
	}

	public String getStatus()
	{
		return m_status ;
	}
	public void setStatus(String v)
	{
		m_status = v;
	}

	public String getCreateUserId()
	{
		return m_create_user_id ;
	}
	public void setCreateUserId(String v)
	{
		m_create_user_id = v;
	}

	public String getCreateUser()
	{
		return m_create_user ;
	}
	public void setCreateUser(String v)
	{
		m_create_user = v;
	}

	public String getCreateTime()
	{
		return m_create_time ;
	}
	public void setCreateTime(String v)
	{
		m_create_time = v;
	}

	public String getLastUpdateUserId()
	{
		return m_last_update_user_id ;
	}
	public void setLastUpdateUserId(String v)
	{
		m_last_update_user_id = v;
	}

	public String getLastUpdateUser()
	{
		return m_last_update_user ;
	}
	public void setLastUpdateUser(String v)
	{
		m_last_update_user = v;
	}

	public String getLastUpdateTime()
	{
		return m_last_update_time ;
	}
	public void setLastUpdateTime(String v)
	{
		m_last_update_time = v;
	}

	public String getIsSync()
	{
		return m_is_sync ;
	}
	public void setIsSync(String v)
	{
		m_is_sync = v;
	}
		



	public String viewId() throws Exception
	{
		return Value.view(getId());
	}

	public String viewOutBillCode() throws Exception
	{
		return Value.view(getOutBillCode());
	}

	public String viewWarehouseCode() throws Exception
	{
		return Value.view(getWarehouseCode());
	}

	public String viewWarehouseName() throws Exception
	{
		return Value.view(getWarehouseName());
	}

	public String viewCustomerCode() throws Exception
	{
		return Value.view(getCustomerCode());
	}

	public String viewCustomerName() throws Exception
	{
		return Value.view(getCustomerName());
	}

	public String viewRepairBillCode() throws Exception
	{
		return Value.view(getRepairBillCode());
	}

	public String viewCustomerBusCode() throws Exception
	{
		return Value.view(getCustomerBusCode());
	}

	public String viewOtherWarehouseCode() throws Exception
	{
		return Value.view(getOtherWarehouseCode());
	}

	public String viewOtherWarehouseName() throws Exception
	{
		return Value.view(getOtherWarehouseName());
	}

	public String viewOutTime() throws Exception
	{
		return Value.view(getOutTime());
	}

	public String viewOutType() throws Exception
	{
		return Value.view(getOutType());
	}

	public String viewOutMoney() throws Exception
	{
		return Value.view(getOutMoney());
	}

	public String viewRemark() throws Exception
	{
		return Value.view(getRemark());
	}

	public String viewBalanceFlag() throws Exception
	{
		return Value.view(getBalanceFlag());
	}

	public String viewBalanceUserId() throws Exception
	{
		return Value.view(getBalanceUserId());
	}

	public String viewBalanceUser() throws Exception
	{
		return Value.view(getBalanceUser());
	}

	public String viewBalanceTime() throws Exception
	{
		return Value.view(getBalanceTime());
	}

	public String viewStatus() throws Exception
	{
		return Value.view(getStatus());
	}

	public String viewCreateUserId() throws Exception
	{
		return Value.view(getCreateUserId());
	}

	public String viewCreateUser() throws Exception
	{
		return Value.view(getCreateUser());
	}

	public String viewCreateTime() throws Exception
	{
		return Value.view(getCreateTime());
	}

	public String viewLastUpdateUserId() throws Exception
	{
		return Value.view(getLastUpdateUserId());
	}

	public String viewLastUpdateUser() throws Exception
	{
		return Value.view(getLastUpdateUser());
	}

	public String viewLastUpdateTime() throws Exception
	{
		return Value.view(getLastUpdateTime());
	}

	public String viewIsSync() throws Exception
	{
		return Value.view(getIsSync());
	}


	public Conditions toConditions() throws Exception
	{
		Conditions c = super.toConditions();

	c.add(getCondition(OutHead.ID,getId()));

	c.add(getCondition(OutHead.OUT_BILL_CODE,getOutBillCode()));

	c.add(getCondition(OutHead.WAREHOUSE_CODE,getWarehouseCode()));

	c.add(getCondition(OutHead.WAREHOUSE_NAME,getWarehouseName()));

	c.add(getCondition(OutHead.CUSTOMER_CODE,getCustomerCode()));

	c.add(getCondition(OutHead.CUSTOMER_NAME,getCustomerName()));

	c.add(getCondition(OutHead.REPAIR_BILL_CODE,getRepairBillCode()));

	c.add(getCondition(OutHead.CUSTOMER_BUS_CODE,getCustomerBusCode()));

	c.add(getCondition(OutHead.OTHER_WAREHOUSE_CODE,getOtherWarehouseCode()));

	c.add(getCondition(OutHead.OTHER_WAREHOUSE_NAME,getOtherWarehouseName()));

	c.add(getCondition(OutHead.OUT_TIME,getOutTime()));

	c.add(getCondition(OutHead.OUT_TYPE,getOutType()));

	c.add(getCondition(OutHead.OUT_MONEY,getOutMoney()));

	c.add(getCondition(OutHead.REMARK,getRemark()));

	c.add(getCondition(OutHead.BALANCE_FLAG,getBalanceFlag()));

	c.add(getCondition(OutHead.BALANCE_USER_ID,getBalanceUserId()));

	c.add(getCondition(OutHead.BALANCE_USER,getBalanceUser()));

	c.add(getCondition(OutHead.BALANCE_TIME,getBalanceTime()));

	c.add(getCondition(OutHead.STATUS,getStatus()));

	c.add(getCondition(OutHead.CREATE_USER_ID,getCreateUserId()));

	c.add(getCondition(OutHead.CREATE_USER,getCreateUser()));

	c.add(getCondition(OutHead.CREATE_TIME,getCreateTime()));

	c.add(getCondition(OutHead.LAST_UPDATE_USER_ID,getLastUpdateUserId()));

	c.add(getCondition(OutHead.LAST_UPDATE_USER,getLastUpdateUser()));

	c.add(getCondition(OutHead.LAST_UPDATE_TIME,getLastUpdateTime()));

	c.add(getCondition(OutHead.IS_SYNC,getIsSync()));
		
	//add by Wing start
	if (getWarehouseCodes() != null) {
        c.add(OutHead.WAREHOUSE_CODE,Conditions.IN,getWarehouseCodes());
    }
	if (!getProductCode().equalsIgnoreCase("")) {
        c.add(OutHead.ID + " in (select out_bill_id from t_out_sub_his where product_code like ?)",Conditions.CUSTOM, "%" + getProductCode() + "%");
    }
    if (!getProductName().equalsIgnoreCase("")) {
        c.add(OutHead.ID + " in (select out_bill_id from t_out_sub_his where product_name like ?)",Conditions.CUSTOM, "%" + getProductName() + "%" );
    }
    if (!getKeyWord().equalsIgnoreCase(""))
    {
        String[] keyWord = new String[7];
        keyWord[0] = "%" + getKeyWord() + "%";
        keyWord[1] = "%" + getKeyWord() + "%";
        keyWord[2] = "%" + getKeyWord() + "%";
        keyWord[3] = "%" + getKeyWord() + "%";
        keyWord[4] = "%" + getKeyWord() + "%";
        keyWord[5] = "%" + getKeyWord() + "%";
        keyWord[6] = "%" + getKeyWord() + "%";
        
        c.add(OutHead.ID + " in (select out_bill_id from t_out_sub_his a,t_product b where a.product_code = b.CONCENTRICITY_CODE and b.NAME like ? or b.CONCENTRICITY_CODE like ? or b.MODEL like ? " +
              "or b.SPEC like ? or b.PRODUCT_BRAND like ? or b.MANUFATURER like ? or b.APPENDER_PROPERTY like ? )",Conditions.CUSTOM,keyWord); 
    }
    if (!getGetCustomerName().equalsIgnoreCase("")) {
        c.add(OutHead.ID + " in (select out_bill_id from t_out_sub_his where get_customer_name = ?)",Conditions.CUSTOM,getGetCustomerName());
    }
    if (!getBalanceMode().equalsIgnoreCase(""))
    {
        c.add(OutHead.ID + " in (select out_bill_id from t_out_sub_his where balance_mode = ?)",Conditions.CUSTOM,getBalanceMode());
    }
    if (!getIsNormal().equalsIgnoreCase(""))
    {
        c.add(OutHead.ID + " in (select out_bill_id from t_out_sub_his a,t_product b where a.product_code = b.CONCENTRICITY_CODE and b.is_normal = ?)",Conditions.CUSTOM,getIsNormal());
    }
    
    if (!getStartOutTime().equalsIgnoreCase("")) {
        c.add(" out_time >= ?",Conditions.CUSTOM,getStartOutTime()+" 00:00:00");
    }
    
    if (!getEndOutTime().equalsIgnoreCase("")) {
        c.add(" out_time <= ?",Conditions.CUSTOM,getEndOutTime()+" 23:59:59");
    }
    //add by Wing end
			
    c.add(ProductStorage.WAREHOUSE_CODE,Conditions.LIKE,getWarehouseCodeUser()+"%");

		return c ;
	}
	
//add by Wing start
	private String []m_warehouse_codes;
    public String []getWarehouseCodes()
    {
        return m_warehouse_codes ;
    }
    public void setWarehouseCodes(String []warehouseCodes)
    {
        this.m_warehouse_codes = warehouseCodes;
    }

    private String m_product_code = "";
    public String getProductCode()
    {
        return this.m_product_code;
    }
    public void setProductCode(String productCode)
    {
        this.m_product_code = productCode;
    }
    
    private String m_product_name = "";
    public String getProductName()
    {
        return this.m_product_name;
    }
    public void setProductName(String productName)
    {
        this.m_product_name = productName;
    }
    
    private String m_key_word = "";
    public String getKeyWord()
    {
        return m_key_word;
    }
    public void setKeyWord(String keyWord)
    {
        this.m_key_word = keyWord;
    }
    public String viewKeyWord() throws Exception
    {
        return Value.view(getKeyWord());
    }
    
    private String m_get_customer_name = "";
    public String getGetCustomerName()
    {
        return m_get_customer_name;
    }
    public void  setGetCustomerName(String getCustomerName)
    {
        this.m_get_customer_name = getCustomerName ;
    }

    private String m_balance_mode = "";
    public String getBalanceMode() {
        return this.m_balance_mode;
    }
    public void setBalanceMode(String balanceMode) {
        this.m_balance_mode = balanceMode;
    }
    
    private String m_is_normal = "";
    public String getIsNormal() {
        return this.m_is_normal;
    }
    public void setIsNormal(String isNormal) {
        this.m_is_normal = isNormal;
    }
    
    private String m_start_outTime = "";
    public String getStartOutTime() {
        return this.m_start_outTime;
    }
    public void setStartOutTime(String startOutTime) {
        this.m_start_outTime = startOutTime;
    }
    
    private String m_end_outTime = "";
    public String getEndOutTime() {
        return this.m_end_outTime;
    }
    public void setEndOutTime(String endOutTime) {
        this.m_end_outTime = endOutTime;
    }
//add by Wing end
    
    //add by Jackey start    
    private String m_warehouse_code_user = "" ; // all
    public String getWarehouseCodeUser()
    {
        return m_warehouse_code_user ;
    }
    public void setWarehouseCodeUser(String v)
    {
        m_warehouse_code_user = v;
    }
    public String viewWarehouseCodeUser() throws Exception
    {
        return Value.view(getWarehouseCodeUser());
    }
  //add by Jackey end
    
}
